﻿<%@ Page Language="C#" MasterPageFile="~/MasterPages/MasterPage.Master" AutoEventWireup="true" CodeBehind="PhongBan.aspx.cs" Inherits="EC2011_hk1_BT6_1041326_1041337_1041373_1041448.Presentation.PhongBan" Title="Phòng ban" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder3" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
         <asp:DetailsView ID="DetailsView1" runat="server" CellPadding="4" 
        DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None" 
        Height="50px" Width="100%" AllowPaging="True" AutoGenerateRows="False" 
            DataKeyNames="DepartmentID">
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <CommandRowStyle BackColor="#D1DDF1" Font-Bold="True" />
        <RowStyle BackColor="#EFF3FB" />
        <FieldHeaderStyle BackColor="#DEE8F5" Font-Bold="True" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <Fields>
                <asp:BoundField DataField="DepartmentID" HeaderText="DepartmentID" 
                    InsertVisible="False" ReadOnly="True" SortExpression="DepartmentID" />
                <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                <asp:BoundField DataField="URLPhoto" HeaderText="URLPhoto" 
                    SortExpression="URLPhoto" />
                <asp:BoundField DataField="URLHomePage" HeaderText="URLHomePage" 
                    SortExpression="URLHomePage" />
                <asp:TemplateField HeaderText="ShowControl" SortExpression="ShowControl">
                    <EditItemTemplate>
                        <asp:DropDownList ID="ddlUServerControl" 
                                          runat="server" DataField="ShowControl" SelectedValue='<%#Bind("ShowControl")%>'>
                            <asp:ListItem>Gridview</asp:ListItem>
                            <asp:ListItem>Datalist</asp:ListItem>
                            <asp:ListItem>Detailview</asp:ListItem>
                            <asp:ListItem>Repeater</asp:ListItem>
                            <asp:ListItem Value="">Other</asp:ListItem>
                        </asp:DropDownList>
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <asp:DropDownList ID="ddlIServerControl" DataField="ShowControl" runat="server"
                                          SelectedValue='<%#Bind("ShowControl")%>' AutoPostBack="true">
                            <asp:ListItem>Gridview</asp:ListItem>
                            <asp:ListItem>Datalist</asp:ListItem>
                            <asp:ListItem>Detailview</asp:ListItem>
                            <asp:ListItem>Repeater</asp:ListItem>
                            <asp:ListItem Value="">Other</asp:ListItem>
                        </asp:DropDownList>                        
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("ShowControl") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" 
                    ShowInsertButton="True" />
            </Fields>
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <EditRowStyle BackColor="#2461BF" />
        <AlternatingRowStyle BackColor="White" />
    </asp:DetailsView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConflictDetection="CompareAllValues" 
            ConnectionString="<%$ ConnectionStrings:PagingDataConnectionString %>" 
            DeleteCommand="DELETE FROM [Departments] WHERE [DepartmentID] = @original_DepartmentID AND [Name] = @original_Name AND (([URLPhoto] = @original_URLPhoto) OR ([URLPhoto] IS NULL AND @original_URLPhoto IS NULL)) AND (([URLHomePage] = @original_URLHomePage) OR ([URLHomePage] IS NULL AND @original_URLHomePage IS NULL)) AND (([ShowControl] = @original_ShowControl) OR ([ShowControl] IS NULL AND @original_ShowControl IS NULL))" 
            InsertCommand="INSERT INTO [Departments] ([Name], [URLPhoto], [URLHomePage], [ShowControl]) VALUES (@Name, @URLPhoto, @URLHomePage, @ShowControl)" 
            OldValuesParameterFormatString="original_{0}" 
            SelectCommand="SELECT * FROM [Departments]" 
            UpdateCommand="UPDATE [Departments] SET [Name] = @Name, [URLPhoto] = @URLPhoto, [URLHomePage] = @URLHomePage, [ShowControl] = @ShowControl WHERE [DepartmentID] = @original_DepartmentID AND [Name] = @original_Name AND (([URLPhoto] = @original_URLPhoto) OR ([URLPhoto] IS NULL AND @original_URLPhoto IS NULL)) AND (([URLHomePage] = @original_URLHomePage) OR ([URLHomePage] IS NULL AND @original_URLHomePage IS NULL)) AND (([ShowControl] = @original_ShowControl) OR ([ShowControl] IS NULL AND @original_ShowControl IS NULL))">
        <DeleteParameters>
            <asp:Parameter Name="original_DepartmentID" Type="Int32" />
            <asp:Parameter Name="original_Name" Type="String" />
            <asp:Parameter Name="original_URLPhoto" Type="String" />
            <asp:Parameter Name="original_URLHomePage" Type="String" />
            <asp:Parameter Name="original_ShowControl" Type="String" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="Name" Type="String" />
            <asp:Parameter Name="URLPhoto" Type="String" />
            <asp:Parameter Name="URLHomePage" Type="String" />
            <asp:Parameter Name="ShowControl" Type="String" />
            <asp:Parameter Name="original_DepartmentID" Type="Int32" />
            <asp:Parameter Name="original_Name" Type="String" />
            <asp:Parameter Name="original_URLPhoto" Type="String" />
            <asp:Parameter Name="original_URLHomePage" Type="String" />
            <asp:Parameter Name="original_ShowControl" Type="String" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="Name" Type="String" />
            <asp:Parameter Name="URLPhoto" Type="String" />
            <asp:Parameter Name="URLHomePage" Type="String" />
            <asp:Parameter Name="ShowControl" Type="String" />
        </InsertParameters>
        </asp:SqlDataSource>
         <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br/>
          <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> <br />  
    </ContentTemplate>
    </asp:UpdatePanel>  
</asp:Content>
